package com.fanpan26.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

/**
 * @author fanpan26
 */
public class User implements InitializingBean, BeanNameAware, BeanFactoryAware, BeanFactoryPostProcessor {

    public User(){
        System.out.println("initializing Bean User");
    }

    private String name;
    public void setName(String name) {
        System.out.println("set Property name:"+name);
        this.name = name;
    }
    public String getName(){
        return name;
    }

    public void init(){
        System.out.println("invoke init method");
    }


    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("invoke afterPropertiesSet method");
    }


    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("invoke setBeanFactory method");
    }


    @Override
    public void setBeanName(String name) {
        System.out.println("invoke setBeanName method");
    }


    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        System.out.println("invoke postProcessBeanFactory method");
    }
}
